Skip to main content
ICT
A16 - Single Dimension Arrays
 
Main Previous Next
Title Page >  
Summary >  
Lesson A1 >  
Lesson A2 >  
Lesson A3 >  
Lesson A4 >  
Lesson A5 >  
Lesson A6 >  
Lesson A7 >  
Lesson A8 >  
Lesson A9 >  
Lesson A10 >  
Lesson A11 >  
Lesson A12 >  
Lesson A13 >  
Lesson A14 >  
Lesson A15 >  
Lesson A16 >  
Lesson A17 >  
Lesson A18 >  
Lesson A19 >  
Lesson A20 >  
Lesson A21 >  
Lesson A22 >  
Lesson AB23 >  
Lesson AB24 >  
Lesson AB25 >  
Lesson AB26 >  
Lesson AB27 >  
Lesson AB28 >  
Lesson AB29 >  
Lesson AB30 >  
Lesson AB31 >  
Lesson AB32 >  
Lesson AB33 >  
Vocabulary >  
 

LAB ASSIGNMENT A16.1 page 9 of 10

Statistics

Background:

  1. Your instructor will provide you with a text file, (numbers.txt), containing a large (N <= 1000) number of integers. The integers range in value from 0 to 100. The text file has been created with one value on each line. Due to the potential for the sum of the numbers to be very large, you should use a long integer in your calculation to find the average.

  2. The number of integers in the file is unknown.

  3. Your program must find the average, standard deviation, and mode of the list of numbers. The mode is defined as the value(s) present with the highest frequency. Calculating the standard deviation consists of the following steps:

    1. Find the average of the list of numbers.
    2. Determine the difference of each number from the average, and square each difference. Sum all the differences.
    3. Divide this sum by (the number of values - 1).
    4. Take the square root of the above division result from step c.

  4. Example, given this list of numbers: 7 4 5 9 10

    1. The average = 7
    2. Sum of square of differences:


  5. For a normal distribution, 68.3% of the data will lie within one standard deviation of the average, while 95.4% will lie within two standard deviations.

Assignment:

  1. Your program should print out the average, standard deviation, and mode of the data in numbers.txt.
    Format the real numbers to print with 2 decimal places.

  2. Your program must utilize proper modular design and parameter passing.

  3. Turn in your source code and run output.

 

Main Previous Next
Contact
 © ICT 2006, All Rights Reserved.